package com.liuyh.demo.arthastest.controller;

import com.google.common.collect.Lists;
import com.liuyh.demo.arthastest.model.Student;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping(value = "/test")
public class TestController {

    Logger log = LoggerFactory.getLogger(TestController.class);
    @RequestMapping(value = "/test",method = RequestMethod.POST)
    public String test(){
        List<String> kechen1 = Lists.newArrayList("a","b","c");
        for (int i=0;i<9999;i++){
            Student s1 = new Student("zhangsan"+i,"1","1",i,kechen1);
            printStudent(s1);
            try {
                Thread.sleep(2000L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

        return "test";
    }

    private void printStudent(Student student){
        System.out.println(student);
        log.debug(student.toString());
    }
}
